<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('我的已办')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>


            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('business:carPackageAudit:edit')}]];
        var removeFlag = [[${@permission.hasPermi('business:carPackageAudit:remove')}]];
        var statusDatas = [[${@dict.getType('cpa_status')}]];
        var prefix = ctx + "business/carPackageAudit";

        $(function() {
            var options = {
                url: prefix + "/doneTaskList",
                modalName: "我的已办",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'serviceItem.name',
                    title: '套餐名称',
                },
                {
                    field: 'serviceItem.discountPrice',
                    title: '套餐价格'
                },
                {
                    field: 'serviceItem.info',
                    title: '套餐备注',
                    formatter: function(value, row, index) {
                        return $.table.tooltip(value,5);
                    }
                },
                {
                    field: 'createByName',
                    title: '创建人'
                },
                {
                    field: 'createTime',
                    title: '创建时间'
                },
                {
                    field: 'taskName',
                    title: '已办任务'
                },
                {
                    field: 'doneTime',
                    title: '任务完成时间'
                },
                {
                    field: 'status',
                    title: '审核状态',
                    formatter: function(value, row, index) {
                        /**
                         *  statusDatas获取到套餐审核的所有的状态选项
                         *  value: 当前记录的值
                         *  内部是拿到当前记录的值,在所有的状态选项中进行遍历,如果当前记录值==选项中的值,把中文信息返回
                         */
                        return $.table.selectDictLabel(statusDatas, value);
                    }
                },
                {
                    field: 'auditors',
                    title: '当前审核人'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-warning btn-xs" href="javascript:void(0)" onclick="showHistoryDialog(\'' + row.instanceId + '\')"><i class="fa fa-list"></i> 审批历史</a> ');
                        actions.push('<a class="btn btn-info btn-xs" href="javascript:void(0)" onclick="showProcessImgDialog(\'' + row.instanceId + '\')"><i class="fa fa-image"></i> 进度查看</a> ');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
        function showProcessImgDialog(instanceId) {
            var url = prefix + '/processImg?instanceId=' + instanceId;
            $.modal.open("查看流程图", url);
        }
        function showHistoryDialog(instanceId) {
            var url = prefix + '/historyPage?instanceId=' + instanceId;
            $.modal.open("历史审核信息", url);
        }
    </script>
</body>
</html>